bits=0;
bits_e=0;
E=0;
%build_com
TH(1:3,1:6)=[18 44 30 22 90 100;
             18 44 30 22 90 100;
             18 44 30 22 90 100];
for I=1:3
    [component,w,h,levels]=readjas(I);
    
    min_sizew=w/2^levels;
    min_sizeh=h/2^levels;
    [b,be,e]=component_cod(component,min_sizew,min_sizeh,w,h,TH(I,:),I);
    bits=bits+b;
    bits_e=bits_e+be;
    E=E+e;
end;
disp('bits');
disp(bits);
disp(bits_e);
disp(E);